Switch `cargo search` output to stdout
authorAlex Crichton <alex@alexcrichton.com>
Fri, 23 Jun 2017 15:45:12 +0000 (08:45 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 23 Jun 2017 15:45:12 +0000 (08:45 -0700)
Closes #4203

src/cargo/ops/registry.rs
tests/search.rs

index 35ec30257c223cc2071a366b84c49a303ae99a14..42ecdf6bf089f49cf9cd07c56783fecca80ab127 100644 (file)
@@ -423,19 +423,17 @@ pub fn search(query: &str,
             }
             None => name
         };
-        writeln!(config.shell().err(), "{}", line)?;
+        println!("{}", line);
     }
 
     let search_max_limit = 100;
     if total_crates > limit as u32 && limit < search_max_limit {
-        writeln!(config.shell().err(),
-                 "... and {} crates more (use --limit N to see more)",
-                 total_crates - limit as u32)?;
+        println!("... and {} crates more (use --limit N to see more)",
+                 total_crates - limit as u32);
     } else if total_crates > limit as u32 && limit >= search_max_limit {
-        writeln!(config.shell().err(),
-                 "... and {} crates more (go to http://crates.io/search?q={} to see more)",
+        println!("... and {} crates more (go to http://crates.io/search?q={} to see more)",
                  total_crates - limit as u32,
-                 percent_encode(query.as_bytes(), QUERY_ENCODE_SET))?;
+                 percent_encode(query.as_bytes(), QUERY_ENCODE_SET));
     }
 
     Ok(())
index ff224fe95216c4be04c23e7ca2869a133d87000d..db99d8ddf13de58a988475d64a7e40fdfdb8b37d 100644 (file)
@@ -84,7 +84,7 @@ fn simple() {
     assert_that(cargo_process("search").arg("postgres")
                     .arg("--host").arg(registry().to_string()),
                 execs().with_status(0)
-                       .with_stderr_contains("\
+                       .with_stdout_contains("\
 hoare = \"0.1.1\"    # Design by contract style assertions for Rust"));
 }
 
@@ -134,7 +134,7 @@ fn multiple_query_params() {
     assert_that(cargo_process("search").arg("postgres").arg("sql")
                     .arg("--host").arg(registry().to_string()),
                 execs().with_status(0)
-                       .with_stderr_contains("\
+                       .with_stdout_contains("\
 hoare = \"0.1.1\"    # Design by contract style assertions for Rust"));
 }